importClass(android.database.Cursor);

module.exports = {
  getContact: () => {
    var cursor = context
      .getContentResolver()
      .query(android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
    while (cursor.moveToNext()) {
      //读取通讯录的姓名
      var username = cursor.getString(
        cursor.getColumnIndex(android.provider.ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)
      );
      //读取通讯录的号码
      var phoneNumber = cursor.getString(
        cursor.getColumnIndex(android.provider.ContactsContract.CommonDataKinds.Phone.NUMBER)
      );
      console.show();
      if (phoneNumber) {
        log("[名字]：" + username + " [号码]：" + phoneNumber);
      }
    }
  },
};
